import book.BookList;
import user.NormalUser;
import user.User;

import javax.jws.soap.SOAPBinding;
import user.User;
import user.AdminUser;
import user.NormalUser;

import java.util.Scanner;

public class Main {
    public static User login(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名->");
        String userName = scanner.next();
        System.out.println("请输入您的身份->1.普通用户 0.管理员");
        int choice = scanner.nextInt();
        if(choice == 1){
            return new NormalUser(userName);
        }
        return new AdminUser(userName);
    }

    public static void main(String[] args) {
        //用户登录
        //1.获取用户名
        //2.确定身份

        //向上转型
        User user = login();
        BookList bookList = new BookList();
        while (true){
            int choice = user.menu();
            if(choice == -1){
                System.out.println("ByeBye~~");
                break;
            }
            user.doOperation(choice,bookList);
        }
    }
}
